package com.demo.project_template.controller;

import com.demo.project_template.entity.IntegralPayouts;
import com.demo.project_template.service.IntegralPayoutsService;
import com.demo.project_template.vo.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 积分提现配置 前端控制器
 * </p>
 *
 * @author 杨玉龙
 * @since 2024-08-20 11:48:57
 */
@Api(tags = "积分提现配置")
@RestController
@RequestMapping("/integralPayouts")
public class IntegralPayoutsController {

    @Resource
    private IntegralPayoutsService integralPayoutsService;

    @ApiOperation(value = "查询积分提现配置列表")
    @GetMapping(value = "/list")
    public R<List<IntegralPayouts>> list(){
        return R.success(integralPayoutsService.list());
    }

    @ApiOperation(value = "添加积分提现配置")
    @PostMapping(value = "/add")
    public R<?> add(@RequestBody IntegralPayouts integralPayouts){
        integralPayoutsService.save(integralPayouts);
        return R.success();
    }

    @ApiOperation(value = "修改积分提现配置")
    @PostMapping(value = "/update")
    public R<?> update(@RequestBody IntegralPayouts integralPayouts){
        integralPayoutsService.updateById(integralPayouts);
        return R.success();
    }

    @ApiOperation(value = "删除积分提现配置")
    @DeleteMapping(value = "/id")
    public R<?> delete(@RequestParam Long id){
        integralPayoutsService.removeById(id);
        return R.success();
    }
}
